<template>
    <div>
        <Modal v-model="showModal" width="800" draggable>
            <p slot="header" style="color:#f60;">
                <span>编辑资源</span>
            </p>
            <div>
                <yaml-editor  v-model="sonValue"  />
            </div>
            <div slot="footer" style="text-align:center">
                <Button  size="default"  type="primary"     @click="submit()">更新</Button>
                <Button  size="default"  type="primary"     @click="cacel_update_deploy">取消</Button>
            </div>
        </Modal>
    </div>
</template>

<script>
// 数据只能单向流动 改造造成代码阅读不方便 放弃
import YamlEditor  from '@/lib/editor/yamlEditor';
export default ({
    name: 'deleteTolerationModal',
    components: { YamlEditor },
    props: {
        isShow: {
            type: Boolean,
        }, 
        value: {
            type: String,
        },
        deploy_name: {
            type: String
        },
    },
    data() {
        return {
            showModal: false,
            // deployment
            sonValue: '',
        }
    },
    methods: {
        cacel_update_deploy() {
            this.$emit('closeModal')
        },
        submit(){
            this.$emit('UpdateDeployment',this.sonValue)
        },
       
    },
    mounted: function() {
        // this.init()
    },
    watch: {
        isShow(newVal,oldVal) {
            console.log("监听到isShow变化"+newVal,oldVal)
            this.showModal = newVal
        },
        value(newVal,oldVal) {
            console.log("监听到isShow变化"+newVal,oldVal)
            this.sonValue = newVal
        }
    }
})


</script>


